<template>
  <view class="container">
    <!-- 轮播图 -->
    <swiper
      autoplay
      class="swiper"
      indicator-dots
      circular
      interval="5000"
      duration="500"
      indicator-color="#8799a3"
      indicator-active-color="#0081ff"
      indicator-dots
    >
      <swiper-item v-for="item in swiperList" :key="item.id">
        <!-- 因为每个type=imgid 里的图片名称不同 -->
        <image :src="item.url"></image>
      </swiper-item>
    </swiper>
    <!-- 生活工具箱 -->
    <view class="lifeToolBox animation-slide-bottom margin-lg">
      <view class="classify appmenu-box">
        <view class="cu-bar bg-white solid-bottom">
          <view class="action">
            <text class="iconfont iconshenghuo iconfont-title text-red"></text>
            生活工具箱
          </view>
        </view>
        <view class="navs cu-list grid col-3 no-border">
          <view
            class="cu-item"
            @tap="lifeToolsItemClick(item.path)"
            v-for="(item, index) in lifeTools"
            :key="index"
            v-if="index < gridCol * 2"
          >
            <view :class="item.icont"></view>
            <text>{{ item.title }}</text>
          </view>
        </view>
      </view>
    </view>
    <!-- 教务工具箱 -->
    <view class="lifeToolBox animation-slide-bottom margin-lg" >
      <view class="classify appmenu-box">
        <view class="cu-bar bg-white solid-bottom">
          <view class="action">
            <text class="iconfont iconcredit iconfont-title text-green"></text>
            教务工具箱
          </view>
        </view>
        <view class="navs cu-list grid col-3 no-border">
          <view
            class="cu-item"
            v-for="(item, index) in eduTools"
            :key="index"
            @tap="eduToolsItemClick(item.path)"
            v-if="index < gridCol * 2"
          >
            <view :class="item.icon"></view>
            <text>{{ item.name }}</text>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
const app = getApp();
const imgPrefix = app.globalData.imgUrl + "resourse/";
export default {
  data() {
    return {
      gridCol: 3, // 应用列表
      key: app.globalData.keySchInfo,
      cardCur: 0,
      isrc: "",
      isrcck: 123,
      isAuthUsing: false, //认证标识
      swiperList: [
        {
          id: 0,
          type: "image",
          url: imgPrefix + "/swiper (1).png",
        },
        {
          id: 1,
          type: "image",
          url: imgPrefix + "/swiper (2).png",
        },
        {
          id: 2,
          type: "image",
          url: imgPrefix + "/swiper (3).png",
        },
        {
          id: 3,
          type: "image",
          url: imgPrefix + "/swiper (4).png",
        },
        {
          id: 4,
          type: "image",
          url: imgPrefix + "/swiper (5).png",
        },
        {
          id: 5,
          type: "image",
          url: imgPrefix + "/swiper (6).png",
        },
        {
          id: 6,
          type: "image",
          url: imgPrefix + "/swiper (7).png",
        },
        {
          id: 7,
          type: "image",
          url: imgPrefix + "/swiper (8).png",
        },
        {
          id: 8,
          type: "image",
          url: imgPrefix + "/swiper (9).png",
        },
      ],
      eduTools: [
        {
          icon: "iconfont iconxuefen2",
          color: "cyan",
          badge: 0,
          size: 100,
          name: "学分绩",
          path: "/pages/home/appmenu/studyPoint",
        },
        {
          icon: "iconfont iconchengjigai",
          color: "cyan",
          size: 100,
          badge: 0,
          name: "成绩查询",
          path: "/pages/home/appmenu/scoreQuery",
        },
        {
          icon: "iconfont iconchengji",
          color: "cyan",
          badge: 0,
          size: 100,
          name: "学分",
          path: "/pages/home/appmenu/credit",
        },
        {
          icon: "iconfont iconyixuan",
          color: "cyan",
          badge: 0,
          size: 100,
          name: "已选课程",
          path: "/pages/home/appmenu/selectedCourses",
        },
        // {
        // 	icon: 'iconshizhong1',
        // 	color: 'cyan',
        // 	badge: 0,
        // 	size: 100,
        // 	name: '课程表',
        // 	url: '../course/course'
        // },
      ],
      lifeTools: [
        {
          icont: "iconfont iconjisuanqi1",
          title: "体测计算",
          color: "cyan",
          badge: 0,
          size: 100,
          path: "/pages/home/appmenu/physical",
        },
        {
          icont: "iconfont iconshiwuzhaoling1",
          title: "寻物-招领",
          color: "cyan",
          badge: 0,
          size: 100,
          path: "/pages/home/appmenu/lostFound",
        },
        {
          icont: "iconfont iconriji1",
          title: "日程",
          color: "cyan",
          badge: 0,
          size: 100,
          path: "/pages/home/appmenu/schedule",
        },
        {
          icont: "iconfont iconershou2",
          title: "跳蚤市场",
          color: "cyan",
          badge: 0,
          size: 100,
          path: "/pages/home/appmenu/fleaMarket",
        },
      ],
    };
  },
  onLoad() {},
  methods: {
    eduToolsItemClick(path) {
      uni.navigateTo({
        url: path,
      });
      console.log(path);
    },
    lifeToolsItemClick(path) {
      console.log("11");
      uni.navigateTo({
        url: path,
      });
    },
  },
};
</script>

<style lang="scss">
.container {
  padding-bottom: 200rpx;
  .swiper {
    width: 100%;
    height: 300rpx;
    padding: 0 40rpx;
  }
}

.swiper image {
  height: 100%;
  width: 100%;
  border-radius: 10rpx;
}
/* 生活工具箱样式 */
.lifeToolBox {
}
.container .lifeToolBox .appmenu-box {
  border-radius: 30rpx;
  overflow: hidden;
  box-shadow: 10rpx 10rpx 10px #ccc;
  margin-top: 10rpx;
}
.container .lifeToolBox .appmenu-box .action {
  font-weight: 600;
}
.container .lifeToolBox .appmenu-box .iconfont-title {
  margin-right: 20rpx;
}
.iconfont {
  font-size: 60rpx;
}
</style>
